package cn.com.dhcc.app.pub.core.util;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;

public class JVMReader {
	public static String[] getJvmArgs() throws Exception {

		MBeanServerConnection mBeanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer();
		try {
			ObjectName commandLine = new ObjectName("java.lang:type=Runtime");
			String[] jvmArgs = (String[]) mBeanServer.getAttribute(commandLine, "InputArguments");
			return jvmArgs;
		} catch (Exception e) {
			throw new Exception("获取jvm args错误");
		}
	}
}
